package com.gengzp.mq.server.controller;

import com.gengzp.mq.common.model.base.MqResult;
import com.gengzp.mq.common.model.resp.SearchMessageCountResp;
import com.gengzp.mq.server.service.IGengzpMqDashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName GengzpMqDashboardController
 * @Description 消息队列仪表盘控制类
 * @Author gengzp
 * @Date 2025/7/23 15:25
 */
@RestController
@RequestMapping("/gengzp/mq/dashboard")
public class GengzpMqDashboardController {

    @Autowired
    private IGengzpMqDashboardService gengzpMqDashboardService;

    /**
     * 查询消息计数信息
     */
    @PostMapping("/search_message_count")
    public MqResult<List<SearchMessageCountResp>> searchMessageCount() {
        return MqResult.getSuccessResult(gengzpMqDashboardService.searchMessageCount());
    }

    /**
     * 查询消费失败超过三次的消息计数信息 (死信消息计数)
     */
    @PostMapping("/search_death_message_count")
    public MqResult<List<SearchMessageCountResp>> searchDeathMessageCount() {
        return MqResult.getSuccessResult(gengzpMqDashboardService.searchDeathMessageCount());
    }

}
